package com.cxyzy.demo

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_second.*

class SecondActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_second)
        //获取字符串值
        val name = intent.getStringExtra("name")
        //获取整型值
        val age = intent.getIntExtra("age", 0)
        //获取布尔值
        val isOk = intent.getBooleanExtra("isOk", true)
        showContent(name, age, isOk)
    }

    private fun showContent(name: String?, age: Int, isOk: Boolean) {
        descTextView.text = "名字：$name；年龄：$age；isOk：$isOk"
    }
}
